<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\ProductTag;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Controllers\AdminController;

class ProductTagController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new ProductTag(), function (Grid $grid) {
            $grid->quickCreate(function (Grid\Tools\QuickCreate $create) {
                $create->email('name', '标签名称');
            });
            $grid->id->sortable();
            $grid->name;

            $grid->actions(function ($actions) {
               $actions->disableView();
            });
        
            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
                $filter->equal('name');
            });
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new ProductTag(), function (Form $form) {
            $form->display('id');
            $form->text('name');
        });
    }
}
